package 笔记.设计模式.抽象工厂模式;

/**
 * @author chenhailong
 * @ClassName: AnimalFactroy
 * @Description: TODO
 * @date 2021/6/29 21:07
 * @Version 1.0
 */
public class AnimalFactroy extends FactoryAbstract {

    @Override
    public Animal getAnimal(String string) {
        if (string == null || string.isEmpty()) {
            return null;
        }
        if (string.equalsIgnoreCase("animalOne")) {
            return new AnimalOne();
        } else if (string.equalsIgnoreCase("animalTwo")) {
            return new AnimalTwo();
        }else
            return null;
    }

    @Override
    public Plant getPlant(String str) {
        return null;
    }
}
